﻿// Decompiled with JetBrains decompiler
// Type: UnityEngine.Rendering.VertexAttributeDescriptor
// Assembly: UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// MVID: E6AE6B5A-2752-4B07-9528-C8B77C62CE79
// Assembly location: C:\Users\windys\Unity\2021.3.39f1c1\Editor\Data\Managed\UnityEngine\UnityEngine.CoreModule.dll
// XML documentation location: C:\Users\windys\Unity\2021.3.39f1c1\Editor\Data\Managed\UnityEngine\UnityEngine.CoreModule.xml

using System;
using UnityEngine.Scripting;

#nullable disable
namespace UnityEngine.Rendering
{
  /// <summary>
  ///   <para>Information about a single VertexAttribute of a Mesh vertex.</para>
  /// </summary>
  [UsedByNativeCode]
  /// <summary>
  ///   <para>Create a VertexAttributeDescriptor structure.</para>
  /// </summary>
  /// <param name="attribute">The VertexAttribute.</param>
  /// <param name="format">Format of the vertex attribute. Default is VertexAttributeFormat.Float32.</param>
  /// <param name="dimension">Dimensionality of the vertex attribute (1 to 4). Default is 3.</param>
  /// <param name="stream">Vertex buffer stream that the attribute should be placed in. Default is 0.</param>
  public struct VertexAttributeDescriptor(
    VertexAttribute attribute = VertexAttribute.Position,
    VertexAttributeFormat format = VertexAttributeFormat.Float32,
    int dimension = 3,
    int stream = 0) : IEquatable<VertexAttributeDescriptor>
  {
    /// <summary>
    ///   <para>The vertex attribute.</para>
    /// </summary>
    public VertexAttribute attribute { get; set; } = attribute;

    /// <summary>
    ///   <para>Format of the vertex attribute.</para>
    /// </summary>
    public VertexAttributeFormat format { get; set; } = format;

    /// <summary>
    ///   <para>Dimensionality of the vertex attribute.</para>
    /// </summary>
    public int dimension { get; set; } = dimension;

    /// <summary>
    ///   <para>Which vertex buffer stream the attribute should be in.</para>
    /// </summary>
    public int stream { get; set; } = stream;

    public override string ToString()
    {
      return string.Format("(attr={0} fmt={1} dim={2} stream={3})", (object) this.attribute, (object) this.format, (object) this.dimension, (object) this.stream);
    }

    public override int GetHashCode()
    {
      return ((int) ((int) (17 * 23 + this.attribute) * 23 + this.format) * 23 + this.dimension) * 23 + this.stream;
    }

    public override bool Equals(object other)
    {
      return other is VertexAttributeDescriptor other1 && this.Equals(other1);
    }

    public bool Equals(VertexAttributeDescriptor other)
    {
      return this.attribute == other.attribute && this.format == other.format && this.dimension == other.dimension && this.stream == other.stream;
    }

    public static bool operator ==(VertexAttributeDescriptor lhs, VertexAttributeDescriptor rhs)
    {
      return lhs.Equals(rhs);
    }

    public static bool operator !=(VertexAttributeDescriptor lhs, VertexAttributeDescriptor rhs)
    {
      return !lhs.Equals(rhs);
    }
  }
}
